package BehavioralPatterns.Memento.Game;

public class Test {

  public static void main(String[] args) {
    GameRole gameRole = new GameRole();
    gameRole.setVit(100);
    gameRole.setDef(100);

    System.out.println("大战前的状态：");
    gameRole.display();

//    保存当前状态
    CareTaker careTaker = new CareTaker();
    careTaker.setMemento(gameRole.createMemento());
//    大战
    gameRole.setVit(30);
    gameRole.setDef(30);
    System.out.println("和boss大战：");
    gameRole.display();

//    大战后恢复
    gameRole.recoverFromMemento(careTaker.getMemento());
    System.out.println("大战后的状态：");
    gameRole.display();
  }
}
